.class public Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;
.super Lcom/teewoo/app/bus/inface/BaseActivity;
.source "SearchByChangeResultActivity.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity$MyAdapter;
    }
.end annotation


# instance fields
.field private changeHistoryManager:Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;

.field private countView:Landroid/widget/TextView;

.field private fromStationId:I

.field private keyWord:Ljava/lang/String;

.field private proBar:Landroid/widget/ProgressBar;

.field private solutionListView:Landroid/widget/ListView;

.field private solutions:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Lcom/teewoo/app/bus/model/Solution;",
            ">;"
        }
    .end annotation
.end field

.field private titleView:Landroid/widget/TextView;

.field private toStationId:I


# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    const/4 v0, -0x1

    .line 33
    invoke-direct {p0}, Lcom/teewoo/app/bus/inface/BaseActivity;-><init>()V

    .line 37
    iput v0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->fromStationId:I

    .line 38
    iput v0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->toStationId:I

    .line 42
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->keyWord:Ljava/lang/String;

    .line 33
    return-void
.end method

.method static synthetic access$0(Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;)V
    .locals 0
    .parameter

    .prologue
    .line 74
    invoke-direct {p0}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->dataRequestAndProgress()V

    return-void
.end method

.method static synthetic access$1(Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;)Landroid/widget/ProgressBar;
    .locals 1
    .parameter

    .prologue
    .line 39
    iget-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->proBar:Landroid/widget/ProgressBar;

    return-object v0
.end method

.method static synthetic access$2(Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;)Landroid/widget/TextView;
    .locals 1
    .parameter

    .prologue
    .line 35
    iget-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->titleView:Landroid/widget/TextView;

    return-object v0
.end method

.method static synthetic access$3(Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;)Ljava/util/List;
    .locals 1
    .parameter

    .prologue
    .line 41
    iget-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->solutions:Ljava/util/List;

    return-object v0
.end method

.method static synthetic access$4(Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;)Landroid/widget/TextView;
    .locals 1
    .parameter

    .prologue
    .line 36
    iget-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->countView:Landroid/widget/TextView;

    return-object v0
.end method

.method static synthetic access$5(Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;)Landroid/widget/ListView;
    .locals 1
    .parameter

    .prologue
    .line 34
    iget-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->solutionListView:Landroid/widget/ListView;

    return-object v0
.end method

.method static synthetic access$6(Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;)Landroid/content/Context;
    .locals 1
    .parameter

    .prologue
    .line 33
    iget-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->context:Landroid/content/Context;

    return-object v0
.end method

.method private dataRequestAndProgress()V
    .locals 4

    .prologue
    const/4 v3, -0x1

    .line 76
    invoke-virtual {p0}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->getIntent()Landroid/content/Intent;

    move-result-object v0

    .line 77
    .local v0, bundle:Landroid/content/Intent;
    const-string v2, "com.teewoo.app.bus.search.change.from.id"

    invoke-virtual {v0, v2, v3}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v2

    iput v2, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->fromStationId:I

    .line 78
    const-string v2, "com.teewoo.app.bus.search.change.to.id"

    invoke-virtual {v0, v2, v3}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v2

    iput v2, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->toStationId:I

    .line 79
    const-string v2, "com.teewoo.app.bus.search.station"

    invoke-virtual {v0, v2}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->keyWord:Ljava/lang/String;

    .line 81
    iget v2, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->fromStationId:I

    if-eq v2, v3, :cond_0

    iget v2, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->toStationId:I

    if-ne v2, v3, :cond_1

    .line 82
    :cond_0
    iget-object v2, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->context:Landroid/content/Context;

    const v3, 0x7f080028

    invoke-static {v2, v3}, Lcom/teewoo/app/bus/util/DialogUtil;->baseDialog(Landroid/content/Context;I)V

    .line 169
    :goto_0
    return-void

    .line 85
    :cond_1
    :try_start_0
    iget v2, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->fromStationId:I

    iget v3, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->toStationId:I

    invoke-static {v2, v3}, Lcom/teewoo/app/bus/util/SearchUtil;->getChangeSolutions(II)Ljava/util/List;

    move-result-object v2

    iput-object v2, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->solutions:Ljava/util/List;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 89
    :goto_1
    iget-object v2, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->solutions:Ljava/util/List;

    if-eqz v2, :cond_3

    .line 90
    iget-object v2, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->solutions:Ljava/util/List;

    invoke-interface {v2}, Ljava/util/List;->size()I

    move-result v2

    if-lez v2, :cond_2

    .line 92
    invoke-direct {p0}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->saveChangeSearchHistory()V

    .line 93
    new-instance v2, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity$3;

    invoke-direct {v2, p0}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity$3;-><init>(Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;)V

    invoke-virtual {p0, v2}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->runOnUiThread(Ljava/lang/Runnable;)V

    goto :goto_0

    .line 86
    :catch_0
    move-exception v2

    move-object v1, v2

    .line 87
    .local v1, e:Ljava/lang/Exception;
    iget-object v2, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->context:Landroid/content/Context;

    const v3, 0x7f080017

    invoke-static {v2, v3}, Lcom/teewoo/app/bus/util/ToastUtil;->showToastCenter(Landroid/content/Context;I)V

    goto :goto_1

    .line 127
    .end local v1           #e:Ljava/lang/Exception;
    :cond_2
    new-instance v2, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity$4;

    invoke-direct {v2, p0}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity$4;-><init>(Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;)V

    invoke-virtual {p0, v2}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->runOnUiThread(Ljava/lang/Runnable;)V

    goto :goto_0

    .line 150
    :cond_3
    new-instance v2, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity$5;

    invoke-direct {v2, p0}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity$5;-><init>(Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;)V

    invoke-virtual {p0, v2}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->runOnUiThread(Ljava/lang/Runnable;)V

    goto :goto_0
.end method

.method private saveChangeSearchHistory()V
    .locals 10

    .prologue
    .line 175
    iget-object v4, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->changeHistoryManager:Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;

    iget v5, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->fromStationId:I

    iget v6, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->toStationId:I

    invoke-virtual {v4, v5, v6}, Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;->findByIds(II)Lcom/teewoo/app/bus/model/history/ChangeHistory;

    move-result-object v0

    .line 176
    .local v0, chHis:Lcom/teewoo/app/bus/model/history/ChangeHistory;
    if-eqz v0, :cond_0

    .line 177
    invoke-static {}, Lcom/teewoo/app/bus/util/Utils;->getLocCurrentTime()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v0, v4}, Lcom/teewoo/app/bus/model/history/ChangeHistory;->setSearchTime(Ljava/lang/String;)V

    .line 178
    iget-object v4, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->changeHistoryManager:Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;

    invoke-virtual {v4, v0}, Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;->update(Lcom/teewoo/app/bus/model/history/ChangeHistory;)V

    .line 187
    :goto_0
    return-void

    .line 180
    :cond_0
    iget-object v4, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->changeHistoryManager:Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;

    invoke-virtual {v4}, Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;->getCount()J

    move-result-wide v1

    .line 181
    .local v1, count:J
    const-wide/16 v4, 0x5

    cmp-long v4, v1, v4

    if-ltz v4, :cond_1

    .line 182
    iget-object v4, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->changeHistoryManager:Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;

    invoke-virtual {v4}, Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;->getAll()Ljava/util/List;

    move-result-object v3

    .line 183
    .local v3, list:Ljava/util/List;,"Ljava/util/List<Lcom/teewoo/app/bus/model/history/ChangeHistory;>;"
    iget-object v5, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->changeHistoryManager:Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;

    invoke-interface {v3}, Ljava/util/List;->size()I

    move-result v4

    const/4 v6, 0x1

    sub-int/2addr v4, v6

    invoke-interface {v3, v4}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Lcom/teewoo/app/bus/model/history/ChangeHistory;

    invoke-virtual {v4}, Lcom/teewoo/app/bus/model/history/ChangeHistory;->getId()Ljava/lang/Integer;

    move-result-object v4

    invoke-virtual {v5, v4}, Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;->delete(Ljava/lang/Integer;)V

    .line 185
    .end local v3           #list:Ljava/util/List;,"Ljava/util/List<Lcom/teewoo/app/bus/model/history/ChangeHistory;>;"
    :cond_1
    iget-object v4, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->changeHistoryManager:Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;

    new-instance v5, Lcom/teewoo/app/bus/model/history/ChangeHistory;

    iget-object v6, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->keyWord:Ljava/lang/String;

    iget v7, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->fromStationId:I

    invoke-static {v7}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v7

    iget v8, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->toStationId:I

    invoke-static {v8}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v8

    invoke-static {}, Lcom/teewoo/app/bus/util/Utils;->getLocCurrentTime()Ljava/lang/String;

    move-result-object v9

    invoke-direct {v5, v6, v7, v8, v9}, Lcom/teewoo/app/bus/model/history/ChangeHistory;-><init>(Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;)V

    invoke-virtual {v4, v5}, Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;->save(Lcom/teewoo/app/bus/model/history/ChangeHistory;)V

    goto :goto_0
.end method


# virtual methods
.method public initialUI()V
    .locals 2

    .prologue
    .line 46
    invoke-super {p0}, Lcom/teewoo/app/bus/inface/BaseActivity;->initialUI()V

    .line 47
    iput-object p0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->context:Landroid/content/Context;

    .line 48
    sget-object v0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->cityView:Landroid/widget/TextView;

    sget-object v1, Lcom/teewoo/app/bus/ui/Home4StaticMap;->currentCityAddress:Ljava/lang/String;

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 49
    const v0, 0x7f0a00a2

    invoke-virtual {p0, v0}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->titleView:Landroid/widget/TextView;

    .line 50
    const v0, 0x7f0a0064

    invoke-virtual {p0, v0}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->countView:Landroid/widget/TextView;

    .line 51
    const v0, 0x7f0a0065

    invoke-virtual {p0, v0}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ListView;

    iput-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->solutionListView:Landroid/widget/ListView;

    .line 52
    const v0, 0x7f0a002a

    invoke-virtual {p0, v0}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ProgressBar;

    iput-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->proBar:Landroid/widget/ProgressBar;

    .line 53
    new-instance v0, Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;

    invoke-direct {v0, p0}, Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->changeHistoryManager:Lcom/teewoo/app/bus/manager/history/ChangeHistoryManager;

    .line 54
    return-void
.end method

.method public onCreate(Landroid/os/Bundle;)V
    .locals 2
    .parameter "savedInstanceState"

    .prologue
    .line 57
    invoke-super {p0, p1}, Lcom/teewoo/app/bus/inface/BaseActivity;->onCreate(Landroid/os/Bundle;)V

    .line 58
    const v0, 0x7f03001c

    invoke-virtual {p0, v0}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->setContentView(I)V

    .line 59
    invoke-virtual {p0}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->initialUI()V

    .line 60
    iget-object v0, p0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;->back:Landroid/view/View;

    new-instance v1, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity$1;

    invoke-direct {v1, p0}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity$1;-><init>(Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;)V

    invoke-virtual {v0, v1}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 66
    new-instance v0, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity$2;

    invoke-direct {v0, p0}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity$2;-><init>(Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity;)V

    .line 70
    invoke-virtual {v0}, Lcom/teewoo/app/bus/ui/SearchByChangeResultActivity$2;->start()V

    .line 71
    return-void
.end method
